<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="java.net.URLDecoder"%>
<%
String zd=Tool.getRequest("zd",request);//必传参数
String fd=Tool.getRequest("fd",request);//必传参数

String list="";

UserService user = (UserService) session.getAttribute(SysConstant.SESSION_NAME);//获得session里面的登陆信息
if(1==2){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		DBManager db = new DBManager();
	
		String sql = "select * from STAFF_INFO where 1=1 ";	
		if(!"".equals(zd)){
			sql+=" and SQUADRON_NO='"+zd+"' ";
		}
		if(!"".equals(fd)){
			sql+=" and UNIT_NO='"+fd+"'";
		}
		String ret="";
		CachedRowSet cr = db.getRowSet(sql);
	
		while(cr.next()){	
			String STAFF_SN=Tool.getRsValue(cr,"STAFF_SN");
			String STAFF_ID=Tool.getRsValue(cr,"STAFF_ID");
			String STAFF_NAME=Tool.getRsValue(cr,"STAFF_NAME");
			String SEXMARK=Tool.getRsValue(cr,"SEXMARK");
			String STAFF_TEL=Tool.getRsValue(cr,"STAFF_TEL");
			String ORGNO=Tool.getRsValue(cr,"ORGNO");
			String SQUADRON_NO=Tool.getRsValue(cr,"SQUADRON_NO");
			String UNIT_NO=Tool.getRsValue(cr,"UNIT_NO");
			String POSITION=Tool.getRsValue(cr,"POSITION");
			String A320V2500_POST=Tool.getRsValue(cr,"A320V2500_POST");
			String A330RRT700_POST=Tool.getRsValue(cr,"A330RRT700_POST");
			String A320V2500_PASS=Tool.getRsValue(cr,"A320V2500_PASS");
			String A330RRT700_PASS=Tool.getRsValue(cr,"A330RRT700_PASS");
			String A320V2500_ENGINE=Tool.getRsValue(cr,"A320V2500_ENGINE");
			String A330RRT700_ENGINE=Tool.getRsValue(cr,"A330RRT700_ENGINE");
			
			ret+="{";
			ret+="\"STAFF_SN\":\""+STAFF_SN+"\",";
			ret+="\"STAFF_ID\":\""+STAFF_ID+"\",";
			ret+="\"STAFF_NAME\":\""+STAFF_NAME+"\",";
			ret+="\"STAFF_TEL\":\""+STAFF_TEL+"\",";
			ret+="\"SEXMARK\":\""+SEXMARK+"\",";
			ret+="\"ORGNO\":\""+ORGNO+"\",";
			ret+="\"SQUADRON_NO\":\""+SQUADRON_NO+"中队\",";
			ret+="\"UNIT_NO\":\""+UNIT_NO+"分队\",";
			if("1".equals(POSITION)){
				POSITION="机械师/分队长";//1—机械师/分队长；2—放行人员；3—上岗人员；4—学徒
			}else if("2".equals(POSITION)){
				POSITION="放行人员";//1—机械师/分队长；2—放行人员；3—上岗人员；4—学徒
			}else if("3".equals(POSITION)){
				POSITION="上岗人员";//1—机械师/分队长；2—放行人员；3—上岗人员；4—学徒
			}else if("4".equals(POSITION)){
				POSITION="学徒";//1—机械师/分队长；2—放行人员；3—上岗人员；4—学徒
			}
			ret+="\"POSITION\":\""+POSITION+"\",";
			ret+="\"A320V2500_POST\":\""+A320V2500_POST+"\",";
			ret+="\"A330RRT700_POST\":\""+A330RRT700_POST+"\",";
			ret+="\"A320V2500_PASS\":\""+A320V2500_PASS+"\",";
			ret+="\"A330RRT700_PASS\":\""+A330RRT700_PASS+"\",";
			ret+="\"A320V2500_ENGINE\":\""+A320V2500_ENGINE+"\",";
			ret+="\"A330RRT700_ENGINE\":\""+A330RRT700_ENGINE+"\"";
			ret+="},";
		}
		if(ret.length()>0){
			ret=ret.substring(0,ret.length()-1);
		}
		list="{\"id\":100,\"list\":["+ret+"]}";
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
